package com.android.qjpmc.data_module;

public class CurveRecordSet {



    CurveRecord m_Head = null;
    CurveRecord m_Tail = null;

    CurveRecord GetHead()
    {
        return m_Head;
    }

    void SetHead(CurveRecord Node)
    {
        m_Head = Node;
    }
    void SetTail(CurveRecord Node)
    {
        m_Tail = Node;
    }

    CurveRecord GetTail()
    {
        CurveRecord Head = GetHead();
        CurveRecord Next = null;
        if (Head == null)
        {
            return null;
        }
        Next = Head.GetNext();
        while (Next != null)
        {
            Head = Next;
            Next = Head.GetNext();
        }
        return Head;
    }
    public int AppendANode(CurveRecord Node)
    {
        if (Node == null)
        {
            return 1;
        }
        CurveRecord Tail = GetTail();
        if (Tail == null)
        {
            SetHead(Node);
            SetTail(GetHead());
        }
        else
        {
            Tail.AppendANode(Node);
            SetTail(Node);
        }
        return 0;
    }


    //释放记录链表
    public int Release()
    {
        CurveRecord Head = GetHead();
        CurveRecord TheNode = null;
        CurveRecord ToDelNode = null;
        TheNode = Head;
        while(TheNode != null)
        {
            ToDelNode = TheNode;
            TheNode = TheNode.GetNext();
            ToDelNode = null;
        }
        return 1;
    }
    //析构函数
    public void finalize()
    {
        Release();
    }
}
